﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using XZL.GM.Bll;
using XZL.GM.Dal;

public partial class Course_CourseTeamList : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            BindTypeList();
            BindCourseTeamList();
        }
    }

    private void BindCourseTeamList()
    {
        int? count = 0;

        int courseType = Convert.ToInt32(ddlCourseType.SelectedValue);

        divCondition.Visible = true;
        gridList.DataSource = CourseInfoBiz.GetCourseTeamList(courseType, netPager.CurrentPageIndex, netPager.PageSize, ref count);
        gridList.DataBind();
        netPager.RecordCount = count.Value;
    }

    private void BindTypeList()
    {
        ddlCourseType.DataSource = CourseInfoBiz.GetCourseTypeList();
        ddlCourseType.DataValueField = "CourseTypeID";
        ddlCourseType.DataTextField = "CourseTypeName";
        ddlCourseType.DataBind();
        ddlCourseType.Items.Insert(0, new ListItem("全部", "0"));
    }

    /// <summary>
    /// 分页控件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void netPager_PageChanged(object sender, EventArgs e)
    {
        BindCourseTeamList();
    }

    protected void btnSelect_Click(object sender, EventArgs e)
    {
        BindCourseTeamList();
        netPager.CurrentPageIndex = 1;
    }


}